package com.zoranjoka.chordis.pages;



import java.util.ArrayList;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.PageAttached;

import com.zoranjoka.chordis.beans.ArtistBean;
import com.zoranjoka.chordis.data.MockDataArtist;

public class Artists {
	
	
	private MockDataArtist dataArtists;
	
	private ArtistBean artistBean;
	
	@InjectPage
	private ArtistDetails adPage;

	
	@PageAttached
	private void InitData(){
		dataArtists = new MockDataArtist();
	}
	
	
	@OnEvent(component="artistDetalilsLink")
	public Object onShowDetails(String name){
		ArtistBean artistBean = dataArtists.getArtistByName(name);
		adPage.setArtist(artistBean);
		return adPage;
	}
	
	
	public ArrayList<ArtistBean> getAllArtists(){
        return dataArtists.getAllArtists();
    }
    public ArtistBean getArtist(){
        return artistBean;
    }
    public void setArtist(ArtistBean a){
        artistBean = a;
    }
	
}
